
// getDistricts
$(function() {
	$("div#district").hide();
getDistrict(){
		alert('gfd');
	$("select#city_id").change(function()
		{   
			$.getJSON("/en/place/Ajax/get-district",
				{
					city_id: $(this).val(), 
					ajax: 'true'
				}, 
                function(json){    
                                var options = '';
                                for (var i = 0; i < json.length; i++) {
                                       options += '<option value="' + json[i].id + '">' + json[i].name + '</option>';
                                }
                                $("div#district").show();
                                if($("select#city_id").val() == 0)
                                {
                                	$("div#district").hide();
                                	$("div#village").hide();
                                }
                                
                               	$("select#district_id").html(options);
             })
     });
	}
});

//get Villages

$(function() {     
	 $("div#village").hide();
    $("select#district_id").change(function()
		{   
			$.getJSON("/en/place/Ajax/get-village",
				{
					district_id: $(this).val(), 
					ajax: 'true'
				}, 
               function(json){    
                               var options = '';
                               for (var i = 0; i < json.length; i++) {
                                      options += '<option value="' + json[i].id + '">' + json[i].name + '</option>';
                               }
                               $("div#village").show();
                               if($("select#district_id").val() == 0)
                               	$("div#village").hide();
                               $("select#village_id").html(options);
                                
            })
           
    });
});